/*
 * $Id$
 */
package corejs.stmt;

import corejs.rt.ActivationRecord;

import corejs.expr.FunctionExpr;


import corejs.util.XmlPrinter;

/**
 *
 * @author myang
 */
public class FunctionDeclaration extends Statement {

   private FunctionExpr _funcExpr;

   public FunctionDeclaration(final FunctionExpr funcExpr) {
      _funcExpr = funcExpr;
   }

   @Override
   public void execute(final ActivationRecord scope) {
   }

   @Override
   public void addTo(final Block current) {
      current.addFunctionDeclaration(this);
   }

   @Override
   public void print(final XmlPrinter printer) {
      _funcExpr.print(printer);
   }
   
   @Override
   public void accept(final StatementVisitor v) {
      v.getRuntimeStack().store(_funcExpr.getName(), 
                                v.visitExpression(_funcExpr));
   }
   
}
